﻿using System;
using RoketSolutions.SP2010.Infrostructure.Localization.Providers;
using RoketSolutions.SP2010.Infrostructure.Localization.Providers.Interfaces;

namespace RoketSolutions.SP2010.Infrostructure.Localization
{
    public static class Resources
    {
        public static IResourceProvider<TSource> For<TSource>(IResourceConfigStorage configStorage)
        {
            return For<TSource>(configStorage.GetConfig());
        } 

        public static IResourceProvider<TSource> For<TSource>(ResourceConfig config)
        {
            if (config == null)
                throw new ArgumentNullException("config");

            var provider = new ResourceProvider<TSource>();
            provider.Init(config);
            return provider;
        }
    }
}